Skip to main content

VPN Status

The commands below are useful once VPN connection has been successfully established.

Get VPN Status​

Requests current VPN connection status.

Login required: Yes

CmdProc Code: OVS_CMD_GET_STATUS

Command number: 5

Input: Not required

Response: OVS_NOTIFY_GET_STATUS

OVS_NOTIFY_GET_STATUS: Successful response OVS_ERR_OK

{ "VPN_Status": ""}

OVS_NOTIFY_GET_STATUS Failed response

data is null

VPN_Status will contain one of the following values:

  1. VPN_NOTIFY_CONNECTING
  2. VPN_NOTIFY_CONNECTED
  3. VPN_NOTIFY_DISCONNECTED
  4. VPN_NOTIFY_CONN_FAILED
  5. VPN_NOTIFY_ABNORMALLY_DISCONNECTED
  6. VPN_NOTIFY_AUTH
  7. VPN_NOTIFY_ASSIGNIP
  8. VPN_NOTIFY_GETCONFIG

Code sample:

C++

void GetVPNStatus()
{
json j_obj;
char szCmd[1024];

j_obj["cmd"] = OVS_CMD_GET_STATUS;

snprintf(szCmd, sizeof(szCmd), "%s", j_obj.dump().c_str());
CmdProc(szCmd);
}

Get Active VPN Profile​

Returns the active VPN connection parameters - server, protocol and port

Login required: Yes

CmdProc Code: OVS_CMD_GET_CURRENT_PROFILE

Command number: 17

Input: Not required

Response: OVS_NOTIFY_GET_CURRENT_PROFILE

OVS_NOTIFY_GET_CURRENT_PROFILE: Successful response OVS_ERR_OK data will return

{
"server_ip": "104.192.3.90",
"protocol": "tcp",
"server_port": 1194
}

OVS_NOTIFY_GET_CURRENT_PROFILE Failed response

  • OVS_ERR_VPN_DISCONNECTED

data is null

Code sample:

C++

void GetCurrentProfile()
{
json j_obj;
char szCmd[1024];

j_obj["cmd"] = OVS_CMD_GET_CURRENT_PROFILE;

snprintf(szCmd, sizeof(szCmd), "%s", j_obj.dump().c_str());
CmdProc(szCmd);
}

Enable IO Counter​

Enables or disables IO counter.

Login required: Yes

CmdProc Code: OVS_CMD_SET_IOCOUNT

Command number: 15

Input:

{ "status": true|false }

Status indicates whether IO counter should be enabled or not.

Response: OVS_NOTIFY_SET_IOCOUNT

OVS_NOTIFY_SET_IOCOUNT: Successful response

  • OVS_NOTIFY_SET_IOCOUNT data is null

OVS_NOTIFY_SET_IOCOUNT Failed response data is null

While IO counter is enabled then SDK keeps issuing the OVS_NOTIFY_VPN_IOCOUNT notification

Data field of OVS_NOTIFY_VPN_IOCOUNT will have the following structure:

{
"data_in": 0,
"speed_in": 0,
"data_out": 0,
"speed_out": 0
}

Where:

  • data_in - Downloaded data amount
  • speed_in - Current download speed
  • data_out - Uploaded data amount
  • speed_out - Current upload speed

Code sample:

C++

void SetIOCount(bool status)
{
json j_obj, j_data_obj;
char szCmd[1024];

j_obj["cmd"] = OVS_CMD_SET_IOCOUNT;
j_data_obj["status"] = status;
j_obj["data"] = j_data_obj;

snprintf(szCmd, sizeof(szCmd), "%s", j_obj.dump().c_str());
CmdProc(szCmd);
}